import request from '@/utils/request'
const group_name = 'spit'
const api_name = 'spit'

export default {
    getList() {
      return request({
        url: `/${group_name}/${api_name}`,
        method: 'get'
      })
    },
    search(page, size, searchMap) {
      return request({
        url: `/${group_name}/${api_name}/search/${page}/${size}`,
        method: 'post',
        data: searchMap
      })
    },
    save(pojo) {
      return request({
        url: `/${group_name}/${api_name}`,
        method: 'post',
        data: pojo
      })
    },
    findById(id) {
      return request({
        url: `/${group_name}/${api_name}/${id}`,
        method: 'get'
      })
    },
    update(id, pojo) {
      if (id === null || id === '') {
        return this.save(pojo)
      }
      return request({
        url: `/${group_name}/${api_name}/${id}`,
        method: 'put',
        data: pojo
      })
    },
    deleteById(id) {
      return request({
        url: `/${group_name}/${api_name}/${id}`,
        method: 'delete'
      })
    },
    ///article/article/examine/{articleId}
    examine(id) {
      return request({
        url: `/${group_name}/${api_name}/examine/${id}`,
        method: 'put'
      })
    },
    sendsms(phone) {
        return request({
            url:`/${group_name}/${api_name}/sendsms/${phone}`,
            method:"put"
        })
    },
    register(code,pojo) { //注册，code：验证码，pojo：用户对象
        return request({
            url:`/${group_name}/${api_name}/register/${code}`,
            method:"post",
            data:pojo
        })
    },
    login(name,password) {
        return request({
            url:`/${group_name}/${api_name}/login`,
            method:"post",
            data: {
                name,  //mobil : mobile
                password
            }
        })
    },
    thumbup(id) {
      return request({
          url:`/${group_name}/${api_name}/thumbup/${id}`,
          method:"put"
      })
    },
    commentlist(id) {
      return request({
        url: `/${group_name}/${api_name}/commentlist/${id}`,
        method: 'post'
      })
    },          

  }
  